<template>
  <div class="safety">
    <div class="header">
        <div class="image">
            <img src="../../../../static/img/logo_1.png" alt="">
        </div>
        <h2>安全宣传</h2>
        <div class="image-1">
            <router-link to="/SafetyPromotion">
                <img src="../../../../static/img/right.png" alt="">
            </router-link>
        </div>
    </div>
    <div class="content">
        <div class="safety-list" v-for="(safetyLists, index) in safetyList" :key="index">
            <div class="left">
                    <img :src="safetyLists.cover" alt="">
            </div>
            <div class="right">
                <router-link :to="{name:'SafetyPromotionDetails',params:{id:safetyLists.id}}">
                <h3>
                    {{safetyLists.title}}
                </h3>
                <p>{{safetyLists.excerpt}}</p>
                </router-link>
            </div>
            <span></span>
        </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'Safety',
  data(){
      return {
        safetyList: []
      }     
  },
  created(){
      this.axios.get('/articles/home',{
          params: {
              category: 2,
              limit: 3
          }
      })
      .then((res) => {
          this.safetyList = res.data.data;
          this.safetyList.unshift(res.data.meta.first);
          console.log(res.data.data);
      })
      .catch((error) => {
          consoloe.log(error);
      })
  }
}
</script>
<style scoped>
.safety{
    width: 100%;
    height: auto;
    margin-top: .24rem;
}
.safety .header{
    width: 100%;
    height: .53rem;
    line-height: .53rem;
}
.safety .header .image{
    width: .53rem;
    height: .53rem;
    float: left;
    margin-left: .2rem;
}
.safety .header .image img{
    width: 100%;
    height: auto;
}
.safety .header h2{
    font-size: .3rem;
    color: #1d2977;
    float: left;
    font-weight: bold;
}
.safety .header .image-1{
    float: right;
    width: .32rem;
    height: .32rem;
    margin-right: .2rem;
    margin-top: .1rem;
}
.safety .header .image-1 img{
    width: 100%;
    height: auto;
}
.safety .content{
    width: 100%;
    height: auto;
    margin-bottom: .5rem;
    margin-top: .23rem;
}
.safety .content .safety-list{
    width: 100%;
    height: auto;
    margin: .4rem auto 0;
}
.safety .content .safety-list .left{
    width: 2rem;
    height: 1.17rem;
    display: inline-block;
    margin-top: .4rem;
    margin-left: .4rem;
}
.safety .content .safety-list>div:nth-child(1){
    margin-top: 0;
}
.safety .content .safety-list span{
    display: inline-block;
    width: 6.7rem;
    border-bottom: .02rem solid #e8e8e8;
    margin-left: .4rem;
}
.safety .content .left img{
    width: 100%;
    height: auto;
}
.safety .content .right{
    margin-left: .2rem;
    width: 4.5rem;
    height: auto;
    display: inline-block;
    vertical-align: top;
}
.safety .content .right h3{
    width: 100%;
    font-size: 14px;
    color: #333;
    height: .43rem;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
}
.safety .content .right h3 a{
    width: 100%;
    font-size: 14px;
    color: #333;
    height: .32rem;
}
.safety .content .right p{
    width: 100%;
    font-size: 12px;
    color: #999;
    height: .65rem;
    overflow: hidden;
}
@media screen and (max-width: 320px) and (min-width: 320px){
.safety .content .right p{
    width: 100%;
    font-size: 12px;
    color: #999;
    height: .8rem;
    overflow: hidden;
}
}  
@media screen and (max-width: 360px) and (min-width: 360px){
.safety .content .right p{
    width: 100%;
    font-size: 12px;
    color: #999;
    height: .7rem;
    overflow: hidden;
}
}  
@media screen and (max-width: 415px) and (min-width: 411px){
.safety .content .right p{
    width: 100%;
    font-size: 12px;
    color: #999;
    height: .62rem;
    overflow: hidden;
}
}  
</style>
